import request from '../utils/request'

// 创建订单
export function createOrder(data) {
  return request({
    url: '/order/create',
    method: 'post',
    data
  })
}

// 查询订单列表
export function getOrderList(params) {
  return request({
    url: '/order/queryOrder',
    method: 'get',
    params: {
      keyword: params.keyword || '',
      pageNum: params.pageNum || 1,
      pageSize: params.pageSize || 10
    }
  })
}

// 获取订单详情
export function getOrderDetails(orderId) {
  return request({
    url: `/order/getDetails/${orderId}`,
    method: 'get'
  })
}

// 取消订单
export function cancelOrder(serialNumber) {
  return request({
    url: `/order/cancel/${serialNumber}`,
    method: 'post'
  })
}

// 支付订单
export function payOrder(serialNumber) {
  return request({
    url: `/alipay/pay/${serialNumber}`,
    method: 'get'
  })
}